home *** CD-ROM | disk | FTP | other *** search
/ PC Pro 2005 June (DVD) / DPPRO0605DVD.iso / Install / program files / Borland / BDS / 3.0 / Objrepos / DelphiDotNet / WebCustomControl.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  2004-10-22  |  2.0 KB  |  70 lines

  1. unit [!UnitName];
  2. // To create a more advanced Web Control that supports live data at
  3. // design time, see instructions in the readme file located in the
  4. // 'BDS\3.0\Source\dbwebcontrols' directory
  5.  
  6. interface
  7.  
  8. uses
  9.   System.Web.UI, System.Web.UI.WebControls,
  10.   System.ComponentModel;
  11.  
  12. type
  13.   /// <summary>
  14.   /// Summary description for My[!CustomControlName].
  15.   /// </summary>
  16.   [DefaultProperty('Text'),
  17.    ToolboxData('<{0}:My[!CustomControlName] runat=server></{0}:My[!CustomControlName]>')]
  18.   My[!CustomControlName] = class(System.Web.UI.WebControls.WebControl)
  19.   strict private
  20.     FText: String;
  21.   strict protected
  22.     // override RenderContents(..) when you inherit from Web.UI.WebControls.WebControl 
  23.     procedure RenderContents(Output: HtmlTextWriter); override;
  24.     
  25.    // override Render(..) when you inherit from Web.UI.WebControls.Control
  26.    // procedure Render(Output: HtmlTextWriter); override;
  27.   public
  28.     constructor Create;
  29.   published
  30.     [Bindable(true),
  31.      Category('Appearance'),
  32.      DefaultValue('')]
  33.     property Text: string read FText write FText;
  34.   end;
  35.  
  36. implementation
  37.  
  38. /// <summary>
  39. /// Define a public parameterless constructor needed by web controls.
  40. /// </summary>
  41. constructor My[!CustomControlName].Create;
  42. begin
  43.   inherited;
  44. end;
  45.  
  46. /// <summary>
  47. /// Render this control to the output parameter specified, preserving
  48. /// cosmetic attribute output generation inherited from standard WebControl.
  49. /// </summary>
  50. /// <param name="output"> The HTML writer to write out to </param>
  51. procedure My[!CustomControlName].RenderContents(Output: HtmlTextWriter);
  52. begin
  53.   Output.Write(Text);
  54. end;
  55.  
  56. {$REGION 'Render override'}
  57. (*
  58. /// <summary>
  59. /// Render this control to the output parameter specified.
  60. /// </summary>
  61. /// <param name="output"> The HTML writer to write out to </param>
  62. procedure My[!CustomControlName].Render(Output: HtmlTextWriter);
  63. begin
  64.   Output.Write(Text);
  65. end;
  66. (* *)
  67. {$ENDREGION}
  68.  
  69. end.
  70.